//
//  NemoFaceUserInfo.m
//  NemoSDKDemo
//
//  Created by 许宝吉 on 2019/3/20.
//  Copyright © 2019 JackYang. All rights reserved.
//

#import "NemoFaceUserInfo.h"
#import "NemoAppDotNetAPIClient.h"
#import "NemoAppDotNetAPIURLConstant.h"

@implementation NemoFaceUserInfo

- (instancetype)initWithDictionary:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        //        kvc赋值
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}
+ (instancetype)faceUserInfoWithDictionary:(NSDictionary *)dic {
    return [[NemoFaceUserInfo alloc] initWithDictionary:dic];
}

+ (NSURLSessionDataTask *)faceUserInfoWithfaceUserId:(long)faceUserId
                                               block:(void (^)(NemoFaceUserInfo *info, NSError *error))block{
    NSDictionary *dic = @{@"faceUserId":[NSNumber numberWithLong:faceUserId],
                          @"enterpriseId":@"you enterpriseId"
//                          @"signature":@"签名方法参考MainViewController"
                          };
    NSString *URLString = [NSString stringWithFormat:@"%@%@",NemoAppDotNetAPIServerPublicString,NemoAppDotNetAPIFaceUserInfoURLString];
    return [[NemoAppDotNetAPIClient sharedClient] GET:URLString
                                           parameters:dic
                                              headers:nil
                                             progress:nil
                                              success:^(NSURLSessionDataTask * __unused task, id JSON) {
        NemoFaceUserInfo *faceUserInfo = [NemoFaceUserInfo faceUserInfoWithDictionary:JSON];
        if (block) {
            block(faceUserInfo, nil);
        }
    } failure:^(NSURLSessionDataTask *__unused task, NSError *error) {
        if (block) {
            block(nil, error);
        }
    }];
}


@end
